﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerManager : MonoBehaviour
{
    public Title playerTitle = Title.the_Developer;
    public string playerName = "YumePro";
    public Races playerRaces = Races.Developer;

    [Header("属性值")]
    public float playerInitialHealth;     // 初始生命值
    public float playerInitialMana;
    public float playerStrength;  // 力量
    public float playerAgility;   // 敏捷
    public float playerIntelligence;  // 智力
    public float playerWillpower; // 意志力
    public float playerLuck;      // 幸运
    public float playerSP;    // 技能点
    [Space]
    public float playerCombatValue; // 战斗力
    [Space]
    public float playerAttackMax;
    public float playerAttackMin;
    public float balance;     // 影响输出最大值的概率
    [Space]
    public float criticalChance;
    public float criticalMultiply;
    public float playerDefence;
    public float playerArmor;
    public float playerArmorRate;
    public float ignoreArmor;
    public float magicSkillDmg;

    [Header("Equipment")]
    public Weapons leftHand;
    public Weapons rightHand;
    public Equipment head;
    public Equipment body;
    public Equipment feet;
    public Equipment necklace;
    public Equipment ring;

    [Header("System Setup")]
    public int bagMax = 50;  // 背包容量
    public int petMax = 10;  // 宠物容量

    public void CalculateStats()
    {
        // 隐形计算
        float strengthModifierMax;
        float strengthModifierMin;
        float agilityModifierMax;
        float agilityModifierMin;

        // 计算力量加成
        strengthModifierMin = playerStrength / 3f;
        strengthModifierMax = playerStrength * 0.4f;
        // 计算敏捷加成
        agilityModifierMin = playerAgility / 3f;
        agilityModifierMax = playerAgility * 0.4f;

        // 当主武器有远程攻击或空手时
        if (leftHand.isRanged || rightHand.isRanged)
        {
            // 远程武器的情况下
            playerAttackMin = strengthModifierMin + agilityModifierMin;
            playerAttackMax = strengthModifierMax + agilityModifierMax;
        }
        else
        {
            // 近战武器的情况下
            playerAttackMin = strengthModifierMin;
            playerAttackMax = strengthModifierMax;
        }

        // 计算角色平衡
        balance = playerAgility / 4;    // 4 Agi = 1 Balance

        // 计算角色魔法技能伤害加成
        magicSkillDmg = playerIntelligence / 20;

        // 计算角色暴击几率
        criticalChance = playerWillpower / 4;

        // 计算角色暴击倍率

        // 计算角色防御力

        // 计算角色护甲值
    }
}
